package com.bestcem.xm.deliver.controller;

import com.alibaba.fastjson.JSONObject;
import com.bestcem.xm.deliver.service.DeliverSmsBalanceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;


@Slf4j
@Api(tags = "问卷投放-短信余额")
@RestController
@RequiredArgsConstructor
@RequestMapping("/deliver/")
public class DeliverSmsBalanceController {

    private @NonNull DeliverSmsBalanceService deliverSmsBalanceService;

    @ApiOperation(value = "短信余额")
    @GetMapping("/balance/")
    public JSONObject getSmsBalance() {
        return deliverSmsBalanceService.getSmsBalance();
    }

    @ApiOperation(value = "修改短信签名")
    @PutMapping("/smsbalances/{id:[a-fA-F0-9]{24}}")
    public JSONObject updateSignature(@PathVariable(value = "id") String id, @RequestBody JSONObject param) {
        return deliverSmsBalanceService.updateSignature(id, param);
    }

}
